let s = "anagram", t = "nagaram"
var isAnagram = function(s, t) {
    let arr = new Array(26).fill(0)
      for(let i=0;i<s.length;i++){
        arr[s[i].charCodeAt()-'a'.charCodeAt()] +=1
    }
    for(let j=0;j<t.length;j++){
        arr[t[j].charCodeAt()-'a'.charCodeAt()] -=1
    }
    for(let item of arr){
        if(item!==0){
            return false
        }
    }
        return true
}
console.log(isAnagram(s,t));
